package com.cover.fti;

import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;

import org.anddev.andengine.opengl.texture.atlas.bitmap.source.AssetBitmapTextureAtlasSource;
import org.anddev.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource;

import org.anddev.andengine.ui.activity.BaseSplashActivity;


import android.app.Activity;


public class SplashActivity extends BaseSplashActivity {

	@Override
	protected ScreenOrientation getScreenOrientation() {
		// TODO Auto-generated method stub
		return ScreenOrientation.LANDSCAPE;
	}

	@Override
	protected IBitmapTextureAtlasSource onGetSplashTextureAtlasSource() {
		// TODO Auto-generated method stub
		return new AssetBitmapTextureAtlasSource(this, "gfx/splash0.png");
	}

	@Override
	protected float getSplashDuration() {
		// TODO Auto-generated method stub
		return 2;
	}

	@Override
	protected Class<? extends Activity> getFollowUpActivity() {
		// TODO Auto-generated method stub
		return SplashActivity2.class;
	}
/*
	// ===========================================================
	// Constants
	// ===========================================================
	private static final int CAMERA_WIDTH = 720;
	private static final int CAMERA_HEIGHT = 480;
	// ===========================================================
	// Fields
	// ===========================================================
	private Camera mCamera;
	private BitmapTextureAtlas mTexture;
	private TextureRegion mSplashTextureRegion;
	private Handler mHandler;
	private int mIdx = 0;

	// ===========================================================
	// Constructors
	// ===========================================================
	// ===========================================================
	// Getter and Setter
	// ===========================================================
	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================
	@Override
	public Engine onLoadEngine() {
		// TODO Auto-generated method stub
		mHandler = new Handler();
		this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
		return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
				new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
				this.mCamera));
	}

	public void onLoadResources() {
		// TODO Auto-generated method stub
		this.mTexture = new BitmapTextureAtlas(512, 512,
				TextureOptions.BILINEAR_PREMULTIPLYALPHA);
		this.mSplashTextureRegion = BitmapTextureAtlasTextureRegionFactory
				.createFromAsset(this.mTexture, this, "gfx/splash0.png", 0, 0);
		this.mEngine.getTextureManager().loadTexture(this.mTexture);
	}

	@Override
	public Scene onLoadScene() {
		// TODO Auto-generated method stub
		this.mEngine.registerUpdateHandler(new FPSLogger());
		final Scene scene = new Scene(1);
		// Center the splash on the camera.
		final int centerX = (CAMERA_WIDTH - this.mSplashTextureRegion
				.getWidth()) / 2;
		final int centerY = (CAMERA_HEIGHT - this.mSplashTextureRegion
				.getHeight()) / 2;
		// Create the sprite and add it to the scene.
		final Sprite splash = new Sprite(centerX, centerY,
				this.mSplashTextureRegion);

		scene.getLastChild().attachChild(splash);
		return scene;
	}

	@Override
	public void onLoadComplete() {
		// TODO Auto-generated method stub
		mHandler.postDelayed(mLaunchTask, 2000);
	}

	private Runnable mLaunchTask = new Runnable() {
		public void run() {
			mTexture.clearTextureAtlasSources();
			mIdx = 1;
			onLoadResources();
			onLoadScene();
			
			// new GameSplashActivity("splash1.png",
			// BubbleDefenseActivity.class);
			Intent myIntent = new Intent(SplashActivity.this,
					BubbleDefenseActivity.class);
			SplashActivity.this.startActivity(myIntent);
			finish();
		}
	};
*/
}
